package cn.lili.modules.distribution.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.distribution.entity.dos.Distribution;
import cn.lili.modules.distribution.entity.dto.DistributionQueryDTO;
import cn.lili.modules.distribution.entity.vos.DistributionVO;
import cn.lili.modules.distribution.fallback.DistributionFallback;
import cn.lili.modules.member.entity.dos.CityDistribution;
import cn.lili.modules.member.entity.vo.NumberOfOwnersReq;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 商品服务分销商品client
 *
 * @author Chopper
 * @version v1.0 2021-11-08 09:52
 */
@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.DISTRIBUTION_SERVICE, contextId = "distribution", fallback = DistributionFallback.class)
public interface DistributionClient {

    @GetMapping("/feign/distribution/updateDistributionAmount")
    void updateDistributionAmount();

    @PostMapping("/getDistribution")
    Distribution getDistribution(@RequestParam String userId);

    /**
     * 查询审核状态下分销员
     * */
    @PostMapping("/getDistributionPass")
    Distribution getDistributionPass(@RequestParam String userId);

    @GetMapping("/getDistributionByTd")
    public Distribution getDistributionById(@RequestParam String id);

    @GetMapping("/feign/addGrossCommission")
    public void addGrossCommission(@RequestParam String id,@RequestParam BigDecimal scoreScale);

    @GetMapping("/feign/addRebateTotal")
    public void addRebateTotal(@RequestParam String id,@RequestParam BigDecimal scoreScale);

    @GetMapping("/feign/subtractScore")
    public void subtractCommission(@RequestParam String id,@RequestParam BigDecimal scoreScale);

    @GetMapping("/feign/addDirectOrderNumber")
    public void addDirectOrderNumber(@RequestParam String id);

    @PostMapping("/feign/getDistributionList")
    @ApiOperation("查询所有分销数据")
    List<Distribution> getDistributionList(@RequestBody Distribution dis);

    @PostMapping("/feign/updateDistributionParentInfo")
    @ApiOperation("更改店主/分销员上级信息")
    Boolean updateDistributionParentInfo(@RequestBody Distribution dis);

    @PostMapping("/feign/clearParentInfo")
    @ApiOperation("清空上级ID")
    Boolean clearParentInfo(@RequestBody Distribution dis);

    /**
     * 获取用户类型
     * @param userIdList 用户列表
     * @return 用户列表
     */
    @PostMapping("/feign/computeType")
    Map<String, Integer> computeType(@RequestBody List<String> userIdList);

    @PostMapping("/feign/getLowerAndLowerComissSubByParentId")
    Double getLowerAndLowerComissSubByParentId(@RequestBody DistributionQueryDTO dto);



    @GetMapping("/feign/getListByName")
    List<Distribution> getListByName (@RequestParam String keyword);

    @GetMapping("/feign/getCountByWraaper")
    Long getCountByWrapper();

    @GetMapping("/feign/getCountByTypeWrapper")
    Long getCountByTypeWrapper(@RequestParam Integer type);

    @PostMapping("/feign/getList")
    List<Distribution> getList(DistributionVO distributionVO);

    @PostMapping("/feign/getListByDistribution")
    List<Distribution> getListByDistribution(@RequestBody DistributionVO distributionVO);


}
